<?php

namespace app\api\model\user;

use app\api\model\order\OrderMusicDetailApiModel;
use app\logic\model\user\UserScoreLogicModel;

class UserScoreApiModel extends UserScoreLogicModel
{

    public function getApiList($param=[], $where=[], $field='*', $page=1, $limit=15)
    {
        $query = $this->where($where)->where(function ($q) use ($param){
            if(check_request($param,'user_id')){
                $q->where('user_id',$param['user_id']);
            }
            if(check_request($param,'status')){
                $q->where('status',$param['status']);
            }
        });
        $list = $query->field($field)->page($page,$limit)->order('id desc')->select()->toArray();
        $count = $query->count();
        return [$list,$count];
    }
}